<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #box {
        width: 400px;
        height: 400px;
        background: yellow;
        font-size: 3rem;
      }
    </style>
  </head>
  <body>
    <div id="box"></div>
    <script>
      const box = document.getElementById("box");

      // box.onmousedown = function () {
      //   console.log("鼠标按下onmousedown");
      // };
      // box.onmouseup = function () {
      //   console.log("鼠标抬起onmouseup");
      // };

      // ------
      // box.onmouseover = function () {
      //   console.log("鼠标移入onmouseover");
      // };

      // box.onmouseout = function () {
      //   console.log("鼠标移出 onmouseout");
      // };

      // ----

      // box.onmousemove = function () {
      //   console.log("鼠标移动 onmousemove");
      // };

      // ----
      box.oncontextmenu = function (e) {
        e.preventDefault();
        console.log("鼠标右击菜单事件 oncontextmenu");
      };
    </script>
  </body>
</html>
